package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.ordermanager.model.ServicePoint;
import com.eling.elcms.travel.model.view.OrderRoomView;
import com.eling.elcms.travel.model.view.RoomStatisticsView;
import com.eling.elcms.travel.service.IRoomStatisticsManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.List;

@Controller
public class RoomStatisticsControllor extends BaseFormController{

	@Autowired
	IRoomStatisticsManager roomStatisticsManager;

	@RequestMapping("/api/roomstatistics/queryallbydate")
	@ResponseBody
	public List<RoomStatisticsView> queryAllByDate(@RequestParam(value="startDate")Date startDate,
								@RequestParam(value="endDate")Date endDate,
								@ModelAttribute ServicePoint servicePoint){
		
		return roomStatisticsManager.queryAllByDate(startDate,endDate,servicePoint);
	}
	
	@RequestMapping("/api/roomstatistics/queryorderroom")
	@ResponseBody
	public List<OrderRoomView> queryOrderRoom(){
		
		return roomStatisticsManager.queryOrderRoom();
	}
}
